package org.restoran.model;

import org.codehaus.jackson.annotate.JsonIgnore;

import javax.persistence.*;
import javax.persistence.Table;

/**
 * @author Snisar Bogdan.
 */
@Entity
@Table(name = "USERS")
public class User extends Person {

    @JsonIgnore
    @Column(name = "API_KEY")
    private String key;

    /**
     * Role of user
     * @see Role
     */
    @JsonIgnore
    @Enumerated(EnumType.STRING)
    @Column(name = "ROLE")
    private Role role;

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    @JsonIgnore
    private String password;

    @JsonIgnore
    private String login;

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    @Override
    public String toString() {
        return "User{" +
                "key='" + key + '\'' +
                ", role=" + role +
                '}';
    }
}

